package utils

import (
	"flag"
	"log"
	"os"
	"github.com/pelletier/go-toml"
)

var (
	confFile = flag.String("conf", "conf/local.toml", "配置文件")
	ServerConfig *toml.TomlTree
)

func InitServerConfig(){
	flag.Parse()
	config, err := toml.LoadFile(*confFile)
	if err != nil {
		log.Fatal("Error ", err.Error())
	}
	if config.Get("server") == nil {
		os.Exit(1)
	}
	ServerConfig = config.Get("server").(*toml.TomlTree)
}